﻿/*MyPhotoIndex Free Photo Organizer <www.myphotoindex.com>
  Copyright (C) <2006-2009>  <Asaf Yarkoni asaf@yarkoni.net>

  This program is free software: you can redistribute it and/or modify
  it under the terms of the GNU General Public License as published by
  the Free Software Foundation, either version 3 of the License, or
  (at your option) any later version.
  
  This program is distributed in the hope that it will be useful,
  but WITHOUT ANY WARRANTY; without even the implied warranty of
  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  GNU General Public License for more details.

  You should have received a copy of the GNU General Public License
  along with this program.  If not, see <http://www.gnu.org/licenses/>.*/
using System;
using System.Collections.Generic;
using System.Text;
using MyPhotoIndex.Interfaces.Tagging;

namespace MyPhotoIndex.Plugins.WebHost
{
    public class SerializedImageTag
    {
        private List<SerializedImageTag> m_childTags = new List<SerializedImageTag>();

        public List<SerializedImageTag> ChildTags
        {
            get { return m_childTags; }
            set { m_childTags = value; }
        }
        private int m_id;

        public int Id
        {
            get { return m_id; }
            set { m_id = value; }
        }
        private string m_name;

        public string Name
        {
            get { return m_name; }
            set { m_name = value; }
        }

        public static void CopyTags(List<IImageTag> tags, List<SerializedImageTag> tagList)
        {
            foreach (IImageTag tag in tags)
            {
                SerializedImageTag newTag = new SerializedImageTag();
                newTag.Id = tag.Id;
                newTag.Name = tag.Name;
                CopyTags(tag.ChildTags, newTag.ChildTags);

                tagList.Add(newTag);
            }
        }
    }

}
